Hello and welcome to this leg show on bounce and the ball.
This will be a two part lecture.
The part one will be refined in the corenda called What We Going To Do we are going to create another
function and split the methods from the previous function.
So let's do that.
There currently we have just the one formation which is the drug function.
But what will it do.
I'm going to create another function called the draw ball function that will be responsible for drawing
the ball on the canvas.
So I'm gonna move a lot of these some of these methods in here into that robot function.
And I will move the Claire rect method in to up into the drawer.
I leave that in the drawer function so let me start by creating the first the job of functions I'll
do that by defining the function.
And then fill a bad name and when to call a drop ball.
When creating a functions it's always a good idea to make the names relevant to what the function is
meant to do.
Still the parent this is there an in-between the parenthesis.
You have your queally braithwaite's inside the curly braces is where you specify what the function is
going to do so this function of called it draw ball.
Okay so what women are going to move some of this methods from here.
Then start from the begin part right up to the close part.
I'm going to move or I'm just going to cut and paste okay for move in there.
I mean bring that to tided out of Pipit.
Okay for my curly braces match up everything is okay then.
Okay so I've created a new fonteyn here draw ball and this is the old function.
But what I need to do I need to make a reference to the drob Ball function here.
Slave can be referenced from this draw from chance or just on the needs of tidy clairette.
I need to insert.
We need to call the draw board function so to do that.
Good Grobe ball.
Okay.
So this function here the drobo will also be called from this draw function.
I am happy with that.
I just click on save and is good to my index and run nothing should change in terms of how the cumbersome
behaves because all I've done is create created an extra function.
Move the methods around so let's see what the cover looks like it should be the same.
Okay so the same to so nicely fully stop the ball leaving the compass.
Here we're going to do that in the next lecture.
Thank you so much for watching.
Bye for now.
Please let me know if you have any questions.